#  date 2013/2/4
#  name create bridge of facial rig's "set driven key"
#  author lizhi
#  E_mail  guishiye@sina.cn
#  QQ  294596787


import maya.cmds as mc
import sys
import commonScripts02 as css

reload(css)

LZ_comman=css.commonScripts()

class createBridgeGrp(object):
    def __init__(self):
        pass
    
    ##------------------  create acial_mouth_bridge  group -----------------------------
    def createMouthBridge(self):
        grpname='facial_mouth_bridge'
        if mc.objExists(grpname)== False:
            mc.group(em=True,n=grpname)
            ###  addAttr to group
            #   create mark addAttrs of  jaw
            LZ_comman.addEnumAttr(objname=[grpname],attrname='_',enumMember='jaw:',key=0)
            #   create jaw member attrtions
            attrBase=['open','side','forward','rotation','up_down']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
                
            #    cretemark addAttrs of mouth_main
            LZ_comman.addEnumAttr(objname=[grpname],attrname='__',enumMember='mouth_main:',key=0)
            #    create mouth_main member attrtions
            attrBase=['L_wide','R_wide','L_up_down','R_up_down','Mouth_LR','Mouth_UD','Mouth_FB','Mouth_Rot_X','Mouth_Rot_Y','Mouth_Rot_Z']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
            #    create addAttr of lips_tweak
            LZ_comman.addEnumAttr(objname=[grpname],attrname='___',enumMember='lips_tweak:',key=0)
            #    create lips_tweak member attrtions
            attrBase=['C_up_lip_roll','C_low_lip_roll']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
            #   create addAttr of lips_follow
            LZ_comman.addEnumAttr(objname=[grpname],attrname='____',enumMember='lips_follow:',key=0)
            #    create lips_follow member attrtions
            attrBase=['L_lip_corner_follow','R_lip_corner_follow','L_up_lip_center_follow','R_up_lip_center_follow','L_low_lip_center_follow','R_low_lip_center_follow','C_up_lip_follow','C_low_lip_follow','up_lip_follow_angle']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
            
            #####  lock and hide the transform attrbutions 
            lockAttrsname=[str(grpname)+'.translateX',str(grpname)+'.translateY',str(grpname)+'.translateZ',str(grpname)+'.rotateX',str(grpname)+'.rotateY',str(grpname)+'.rotateZ',str(grpname)+'.scaleX',str(grpname)+'.scaleY',str(grpname)+'.scaleZ',str(grpname)+'.visibility']
            for k in lockAttrsname:
                LZ_comman.lockAttrs(k)
        else:
            pass
        return(grpname)
    ##------------------  create acial_mouth_bridge  group -----------------------------
    def createEyesBridge(self):
        grpname='facials_eyes_bridge'
        if mc.objExists(grpname)== False:
            mc.group(em=True,n=grpname)
            ###  addAttr to group
            #   create mark addAttrs of  eyelids
            LZ_comman.addEnumAttr(objname=[grpname],attrname='_',enumMember='eyelids:',key=0)
            #   create eyelids member attrtions
            attrBase=['L_UpEyelid_close','L_LowEyelid_close','R_UpEyelid_close','R_LowEyelid_close','L_UpEyelid_shape','L_LowEyelid_shape','R_UpEyelid_shape','R_LowEyelid_shape','EyeLine','L_UpperEye_line','L_LowerEye_line','R_UpperEye_line','R_LowerEye_line','Eyelid_follow','L_EyelidFol_Out','R_EyelidFol_Out','L_EyelidFol_Inn','R_EyelidFol_Inn','L_EyeInnRound_pos','R_EyeInnRound_pos','L_EyeOutRound_pos','R_EyeOutRound_pos','Eyelid_close','L_UpperLid_close_pos_bs','R_UpperLid_close_pos_bs','L_UpperLid_close_neg_bs','R_UpperLid_close_neg_bs','L_LowerEyelid_close_pos_bs','R_LowerEyelid_close_pos_bs','L_LowerEyelid_close_neg_bs','R_LowerEyelid_close_neg_bs']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
                
            #    cretemark addAttrs of pupil
            LZ_comman.addEnumAttr(objname=[grpname],attrname='__',enumMember='pupil:',key=0)
            #    create pupil member attrtions
            attrBase=['L_PupilOuter','L_PupilInner','R_PupilOuter','R_PupilInner']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
            #    create addAttr of eyebrows
            LZ_comman.addEnumAttr(objname=[grpname],attrname='___',enumMember='eyebrows:',key=0)
            #    create eyebrows member attrtions
            attrBase=['L_BrowInn_UD','L_BrowMid_UD','L_BrowOut_UD','R_BrowInn_UD','R_BrowMid_UD','R_BrowOut_UD','L_frown','R_frown']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
            #   create addAttr of eyebrowsComponent
            LZ_comman.addEnumAttr(objname=[grpname],attrname='____',enumMember='eyebrowsComponent:',key=0)
            #    create eyebrowsComponent member attrtions
            attrBase=['L_brow01','L_brow02','L_brow03','L_brow04','L_brow05','R_brow01','R_brow02','R_brow03','R_brow04','R_brow05']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
            #   create addAttr of combinDrive
            LZ_comman.addEnumAttr(objname=[grpname],attrname='_____',enumMember='combinDrive:',key=0)
            #    create combinDrive member attrtions
            attrBase=['L_browBoth_UD','R_browBoth_UD']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
            
            #   create addAttr of general
            LZ_comman.addEnumAttr(objname=[grpname],attrname='______',enumMember='general:',key=0)
            #    create general member attrtions
            attrBase=['autoEyelids','browBumpTune']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
            
            #####  lock and hide the transform attrbutions 
            lockAttrsname=[str(grpname)+'.translateX',str(grpname)+'.translateY',str(grpname)+'.translateZ',str(grpname)+'.rotateX',str(grpname)+'.rotateY',str(grpname)+'.rotateZ',str(grpname)+'.scaleX',str(grpname)+'.scaleY',str(grpname)+'.scaleZ',str(grpname)+'.visibility']
            for k in lockAttrsname:
                LZ_comman.lockAttrs(k)
        else:
            pass
        return(grpname)
            
    ##------------------  create acial_nose_bridge  group -----------------------------    
    def createNoseBridge(self):
        grpname='facials_nose_cheek_bridge'
        if mc.objExists(grpname)== False:
            mc.group(em=True,n=grpname)
            ###  addAttr to group
          
            attrBase=['nasalis']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
                
            #    cretemark addAttrs of nose
            LZ_comman.addEnumAttr(objname=[grpname],attrname='__',enumMember='nose:',key=0)
            #    create nose member attrtions
            attrBase=['nose_up','nose_side','nose_tilt','L_nostril','R_nostril','L_NoseDilator','R_NoseDilator','L_NoseWrinkler','R_NoseWrinkler','L_sneer','R_sneer']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
            #    create addAttr of cheek
            LZ_comman.addEnumAttr(objname=[grpname],attrname='___',enumMember='cheek:',key=0)
            #    create cheek member attrtions
            attrBase=['L_squint','R_squint','L_Puffer','R_Puffer','L_Orbic','R_Orbic']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
            
            #####  lock and hide the transform attrbutions 
            lockAttrsname=[str(grpname)+'.translateX',str(grpname)+'.translateY',str(grpname)+'.translateZ',str(grpname)+'.rotateX',str(grpname)+'.rotateY',str(grpname)+'.rotateZ',str(grpname)+'.scaleX',str(grpname)+'.scaleY',str(grpname)+'.scaleZ',str(grpname)+'.visibility']
            for k in lockAttrsname:
                LZ_comman.lockAttrs(k)
        else:
            pass
        return(grpname)
            
    ##------------------  create facial_bridge  group -----------------------------            
    def createFacialBridge(self):
        grpname='faciels_bridge'
        if mc.objExists(grpname)== False:
            mc.group(em=True,n=grpname)
            ###  addAttr to group
            #   create mark addAttrs of  blink
            LZ_comman.addEnumAttr(objname=[grpname],attrname='_',enumMember='blink:',key=0)
            #   create blink member attrtions
            attrBase=['L_close_pos','L_close_neg','R_close_pos','R_close_neg']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
                
            #    cretemark addAttrs of cheeks
            LZ_comman.addEnumAttr(objname=[grpname],attrname='__',enumMember='cheeks:',key=0)
            #    create cheeks member attrtions
            attrBase=['L_Smile_pos','L_Smile_neg','R_Smile_pos','R_Smile_neg']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
            #    create addAttr of lipSticky
            LZ_comman.addEnumAttr(objname=[grpname],attrname='___',enumMember='lipSticky:',key=0)
            #    create lipSticky member attrtions
            attrBase=['lipSticky01','lipSticky02','lipSticky03']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
            #   create addAttr of lipShape
            LZ_comman.addEnumAttr(objname=[grpname],attrname='____',enumMember='lipShape:',key=0)
            #    create lipShape member attrtions
            attrBase=['upLipTopRight','upLipTopLeft','upLipBottomRight','upLipBottomLeft','lowLipTopRight','lowLipTopLeft','lowLipBottomRight','lowLipBottomLeft']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
            
            #####  lock and hide the transform attrbutions 
            lockAttrsname=[str(grpname)+'.translateX',str(grpname)+'.translateY',str(grpname)+'.translateZ',str(grpname)+'.rotateX',str(grpname)+'.rotateY',str(grpname)+'.rotateZ',str(grpname)+'.scaleX',str(grpname)+'.scaleY',str(grpname)+'.scaleZ',str(grpname)+'.visibility']
            for k in lockAttrsname:
                LZ_comman.lockAttrs(k)
        else:
            pass
        return(grpname)
            
    ##------------------  create PS_normal_bridge  group -----------------------------        
    def createPS_normalBridge(self):
        grpname='PS_Normal_bridge'
        if mc.objExists(grpname)== False:
            mc.group(em=True,n=grpname)
            ###  addAttr to group
          
            #   create blink member attrtions
            attrBase=['_0_neutral','_1_open_neutral','_2_AH','_3_UH','_4_EH','_5_EE','_6_OH','_7_W','_8_OO','_9_R','_10_ER','_11_YU','_12_G_K','_13_F_V','_14_bite','_15_B_M_P','_16_N_D_T','_17_L','_18_TH','_19_S','_20_SH']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
                
            #####  lock and hide the transform attrbutions 
            lockAttrsname=[str(grpname)+'.translateX',str(grpname)+'.translateY',str(grpname)+'.translateZ',str(grpname)+'.rotateX',str(grpname)+'.rotateY',str(grpname)+'.rotateZ',str(grpname)+'.scaleX',str(grpname)+'.scaleY',str(grpname)+'.scaleZ',str(grpname)+'.visibility']
            for k in lockAttrsname:
                LZ_comman.lockAttrs(k)
        else:
            pass
        return(grpname)            
    
            
    ##------------------  create PS_Smile_bridge  group -----------------------------    
    def createPS_SmileBridge(self):
        grpname='PS_Smile_bridge'
        if mc.objExists(grpname)== False:
            mc.group(em=True,n=grpname)
            ###  addAttr to group
          
            #   create blink member attrtions
            attrBase=['_0_neutral','_1_open_neutral','_2_AH','_3_UH','_4_EH','_5_EE','_6_OH','_7_W','_8_OO','_9_R','_10_ER','_11_YU','_12_G_K','_13_F_V','_14_bite','_15_B_M_P','_16_N_D_T','_17_L','_18_TH','_19_S','_20_SH']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
                
            #####  lock and hide the transform attrbutions 
            lockAttrsname=[str(grpname)+'.translateX',str(grpname)+'.translateY',str(grpname)+'.translateZ',str(grpname)+'.rotateX',str(grpname)+'.rotateY',str(grpname)+'.rotateZ',str(grpname)+'.scaleX',str(grpname)+'.scaleY',str(grpname)+'.scaleZ',str(grpname)+'.visibility']
            for k in lockAttrsname:
                LZ_comman.lockAttrs(k)
        else:
            pass
        return(grpname)    
            
    ##------------------  create PS_Frown_bridge  group -----------------------------        
    def createPS_FrownBridge(self):
        grpname='PS_Frown_bridge'
        if mc.objExists(grpname)== False:
            mc.group(em=True,n=grpname)
            ###  addAttr to group
          
            #   create blink member attrtions
            attrBase=['_0_neutral','_1_open_neutral','_2_AH','_3_UH','_4_EH','_5_EE','_6_OH','_7_W','_8_OO','_9_R','_10_ER','_11_YU','_12_G_K','_13_F_V','_14_bite','_15_B_M_P','_16_N_D_T','_17_L','_18_TH','_19_S','_20_SH']
            for i in attrBase:
                LZ_comman.addAttrs(objname=[grpname],attrname=i,dv=0,key=1)
                
            #####  lock and hide the transform attrbutions 
            lockAttrsname=[str(grpname)+'.translateX',str(grpname)+'.translateY',str(grpname)+'.translateZ',str(grpname)+'.rotateX',str(grpname)+'.rotateY',str(grpname)+'.rotateZ',str(grpname)+'.scaleX',str(grpname)+'.scaleY',str(grpname)+'.scaleZ',str(grpname)+'.visibility']
            for k in lockAttrsname:
                LZ_comman.lockAttrs(k)    
        else:
            pass
        return(grpname) 
    
    def createfacialgrp(self):
        grpname='facial_grp'
        if mc.objExists(grpname)== False:
            mc.group(em=True,n=grpname)
        else:
            pass
        return(grpname)